﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.UC.订单一览新.订单预览新;
using DXApplicationTangche.UC.订单一览新.订单预览新.service;
using DXApplicationTangche.UC.样品管理.样品订单预览;

namespace DXApplicationTangche.UC.订单一览新.改版
{
    public partial class Form改版一览 : DevExpress.XtraEditors.XtraForm
    {
        private OrderCommitDTO返回 orderCommitDTO返回 = new OrderCommitDTO返回();
        public Form改版一览()
        {
            InitializeComponent();
            this.gridControl改版一览.DataSource = new 改版Service().DTO改版s;
            this.bandedGridView改版一览.RefreshData();

        }

        private void simpleButton确认_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.textBox扫批号.Text))
            {
                MessageBox.Show("未扫码");
            }
            new Form改版申请(this.textBox扫批号.Text.Trim()).ShowDialog();
            this.textBox扫批号.Clear();
            this.gridControl改版一览.DataSource = new 改版Service().DTO改版s;
            this.bandedGridView改版一览.RefreshData();
        }

        private void bandedGridView改版一览_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            String orderId = 
                FunctionHelper.GetbandedgridViewValue(this.bandedGridView改版一览, this.bandedGridView改版一览.FocusedRowHandle, "orderId");
            this.orderCommitDTO返回 = 订单预览新Service.get订单预览(orderId);
            if ("48".Equals(this.orderCommitDTO返回.shopId))
            {
                new Form样品订单预览新(
                    orderId,
                    FunctionHelper.GetbandedgridViewValue(
                        this.bandedGridView改版一览,
                        this.bandedGridView改版一览.FocusedRowHandle,
                        "batchNo"
                        )
                    ).ShowDialog();
            }
            else
            {
                new Form订单预览新(
                    orderId,
                    FunctionHelper.GetbandedgridViewValue(
                        this.bandedGridView改版一览,
                        this.bandedGridView改版一览.FocusedRowHandle,
                        "batchNo"
                        ),
                    true
                    ).ShowDialog();
            }
            this.gridControl改版一览.DataSource = new 改版Service().DTO改版s;
            this.bandedGridView改版一览.RefreshData();
        }
    }
}